package model

import (
	"fmt"
	"reflect"

	"gorm.io/gorm"
)

func InitsDb(db *gorm.DB) { //创建表
	db.AutoMigrate(&User{}, &Other{})
	db.AutoMigrate(&Userfrieds{})
}
func Dbquery(c interface{}, n string) interface{} {
	t := reflect.TypeOf(c)
	v := reflect.ValueOf(c)
	for k := 0; k < t.NumField(); k++ {
		key := t.Field(k).Name
		val := v.Field(k).Interface()
		fmt.Print(key, "-", val)
	}
	return nil
}
